#comments-start

Global Const $DLL_MESSAGEBOX = "int MessageBox(hwnd handle, str text, str caption, uint type)"
Global Const $DLL_BEEP = "int Beep(int frequency, int duration)"


_DllCall("User32.dll", $DLL_MESSAGEBOX, 0, "Message", "Title", 0)

_DllCall("Kernel32.dll", $DLL_BEEP, 500, 2000)








; _DllCall by Kip

Func _DllCall($vDll, $sFormat, $vParam1=0, $vParam2=0, $vParam3=0, $vParam4=0, $vParam5=0, $vParam6=0, $vParam7=0, $vParam8=0, $vParam9=0, $vParam10=0, $vParam11=0 _
, $vParam12=0, $vParam13=0, $vParam14=0, $vParam15=0, $vParam16=0, $vParam17=0, $vParam18=0, $vParam19=0, $vParam20=0, $vParam21=0, $vParam22=0, $vParam23=0, $vParam24=0 _
, $vParam25=0, $vParam26=0, $vParam27=0, $vParam28=0, $vParam29=0, $vParam30=0, $vParam31=0, $vParam32=0)

$iParams = @NumParams-2

If not $sFormat Then Return

$sFunction = StringLeft($sFormat, StringInStr($sFormat,"(")-1)

$aFunctionSplit = StringSplit($sFunction," ")

Local $sReturnType
Local $sFunctionName

For $i = 1 to $aFunctionSplit[0]

If $aFunctionSplit[$i] Then

If Not $sFunctionName Then

$sFunctionName = $aFunctionSplit[$i]

Else

$sReturnType = $sFunctionName
$sFunctionName = $aFunctionSplit[$i]

ExitLoop

EndIf

EndIf

Next

If Not $sFunctionName Then Return
If Not $sReturnType Then $sReturnType = "int"

$iStart = StringInStr($sFormat,"(")
$iEnd = StringInStr($sFormat,")")

$sParams = StringMid($sFormat,$iStart+1,$iEnd-$iStart-1)

$aParamsSplit = StringSplit($sParams,",")
If $sParams Then

If $aParamsSplit[0] > $iParams Then
$iParams = $aParamsSplit[0]
EndIf

EndIf

Local $aParameters[$iParams+1][2]

For $i = 1 to $aParamsSplit[0]

$aParamSplit = StringSplit($aParamsSplit[$i]," ")

For $j = 1 to $aParamSplit[0]

If $aParamSplit[$j] Then
$aParameters[$i][0] = $aParamSplit[$j]

ExitLoop
EndIf

Next

Next

If $iParams > 32 Then Return

Local $sFinal

For $i = 1 to $iParams

If Not $aParameters[$i][0] Then Return

$aParameters[$i][1] = Execute("$vParam"&$i)

If IsString($aParameters[$i][1]) Then
$aParameters[$i][1] = StringReplace($aParameters[$i][1],'"','""')
$aParameters[$i][1] = '"'&$aParameters[$i][1]&'"'
EndIf

$sFinal &= ',"'&$aParameters[$i][0]&'",'&$aParameters[$i][1]

Next

If IsString($vDll) Then
$vDll = StringReplace($vDll,'"','""')
$vDll = '"'&$vDll&'"'
EndIf

$sFinal = "DllCall("&$vDll&',"'&$sReturnType&'", "'&$sFunctionName&'"'&$sFinal&")"

Return Execute($sFinal)

EndFunc

#comments-end

#include <Array.au3>

$filePath = "d:\xx.txt"

;Local $fileOriAttr

;$str = 'DllCall("Kernel32.dll" , "int" , "GetFileAttributesW" , "wstr" , $filePath)'





;$fileOriAttr = Execute($str)


;_ArrayDisplay($fileOriAttr)

$dllPath = "D:\xoxo\testksapi.dll"
$returnType = "'" & "long" & "'"
$apiName = "'" & "Invoke_SafeR3_RegEnumKeyW" & "'"

$iRet = DllCall($dllPath , $returnType , $apiName , 'PHKEY', 1528, 'dword', 1, 'ptr', 0, 'dword', 256 ) 



_ArrayDisplay($iRet)